//---------------------------------------------------------------------------

#ifndef on_routeH
#define on_routeH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "FIBDataSet.hpp"
#include "pFIBDataSet.hpp"
#include <DB.hpp>
#include <DBCtrls.hpp>
#include <Mask.hpp>
#include "FIBQuery.hpp"
#include "pFIBQuery.hpp"
#include <ComCtrls.hpp>
//#include <systdate.h>
//---------------------------------------------------------------------------
class TFormOnRoute : public TForm
{
__published:	// IDE-managed Components
        TLabel *Label2;
        TpFIBDataSet *ds_bus;
        TDataSource *DataSourceBus;
        TLabel *Label3;
        TDBEdit *DBEdit2;
        TLabel *Label4;
        TDBEdit *DBEdit3;
        TLabel *Label5;
        TDBEdit *DBEdit4;
        TpFIBDataSet *ds_head;
        TFIBBCDField *ds_headID;
        TFIBBCDField *ds_headPARENT_ID_HEAD;
        TFIBDateField *ds_headDATE_DOC;
        TFIBStringField *ds_headNUM_DOC;
        TFIBDateTimeField *ds_headDATE_SAVE_DOC;
        TFIBBCDField *ds_headID_STATE;
        TFIBBCDField *ds_headID_BUS;
        TFIBBCDField *ds_headID_ROUTE;
        TFIBDateTimeField *ds_headDATE_START_STATE;
        TFIBDateTimeField *ds_headDATE_END_STATE;
        TFIBBCDField *ds_headID_TYPE_DOC;
        TFIBDateTimeField *ds_headDATE_START_DOC;
        TFIBDateTimeField *ds_headDATE_END_DOC;
        TFIBBCDField *ds_headID_PERSONAL_MEDIC;
        TFIBBCDField *ds_headID_PERSONAL_DRIVER;
        TFIBBCDField *ds_headID_PERSONAL_MECHANIC;
        TFIBBCDField *ds_busID_BUS;
        TFIBBCDField *ds_busID_MODELS;
        TFIBStringField *ds_busNUM_BODY;
        TFIBStringField *ds_busNAME_MODELS;
        TFIBStringField *ds_busVIN;
        TFIBStringField *ds_busNUM_VR;
        TFIBDateField *ds_busDATE_VR;
        TFIBStringField *ds_busNUM_TS;
        TFIBDateField *ds_busDATE_TS;
        TFIBBCDField *ds_busID_HEAD_STATE;
        TDataSource *DataSourceHead;
        TFIBBCDField *ds_busID_STATE;
        TFIBBCDField *ds_busID_STATE_NULL;
        TLabel *Label1;
        TLabel *Label6;
    TDateTimePicker *var_date_start_list;
    TDateTimePicker *var_time_start_list;
    TDateTimePicker *var_date_medic;
    TDateTimePicker *var_time_medic;
        TpFIBDataSet *dataset_look_driver;
        TDataSource *ds_look_driver;
        TStringField *ds_headF_driver;
        TLabel *Label7;
        TDBLookupComboBox *DBLookupComboBox1;
        TpFIBDataSet *dataset_look_mechanic;
        TDataSource *ds_machanic;
        TStringField *ds_headF_mechanic;
        TLabel *Label8;
        TDBLookupComboBox *DBLookupComboBox2;
        TpFIBDataSet *dataset_medic;
        TDataSource *ds_medic;
        TStringField *ds_headF_medic;
        TLabel *Label9;
        TDBLookupComboBox *DBLookupComboBox3;
        TpFIBDataSet *dataset_route;
        TDataSource *ds_route;
        TStringField *ds_headF_route;
        TLabel *Label10;
        TDBLookupComboBox *DBLookupComboBox4;
        TDBText *DBText2;
        TFIBStringField *ds_headNOTE;
        TLabel *Label11;
        TLabel *LabelStartRoute;
    TFIBMemoField *ds_headREMARK;
    TDBMemo *DBMemo1;
    TpFIBDataSet *ds_head_list;
    TFIBBCDField *FIBBCDField1;
    TFIBBCDField *FIBBCDField2;
    TFIBDateField *FIBDateField1;
    TFIBStringField *FIBStringField1;
    TFIBDateTimeField *FIBDateTimeField1;
    TFIBBCDField *FIBBCDField3;
    TFIBBCDField *FIBBCDField4;
    TFIBBCDField *FIBBCDField5;
    TFIBDateTimeField *FIBDateTimeField2;
    TFIBDateTimeField *FIBDateTimeField3;
    TFIBBCDField *FIBBCDField6;
    TFIBDateTimeField *FIBDateTimeField4;
    TFIBDateTimeField *FIBDateTimeField5;
    TFIBBCDField *FIBBCDField7;
    TFIBBCDField *FIBBCDField8;
    TFIBBCDField *FIBBCDField9;
    TStringField *StringField1;
    TStringField *StringField2;
    TStringField *StringField3;
    TStringField *StringField4;
    TFIBStringField *FIBStringField2;
    TFIBMemoField *FIBMemoField1;
    TDataSource *DataSourceList;
    TLabel *Label14;
    TDateTimePicker *date_doc;
    TpFIBDataSet *ds_head_medic;
    TFIBBCDField *FIBBCDField10;
    TFIBBCDField *FIBBCDField11;
    TFIBDateField *FIBDateField2;
    TFIBStringField *FIBStringField3;
    TFIBDateTimeField *FIBDateTimeField6;
    TFIBBCDField *FIBBCDField12;
    TFIBBCDField *FIBBCDField13;
    TFIBBCDField *FIBBCDField14;
    TFIBDateTimeField *FIBDateTimeField7;
    TFIBDateTimeField *FIBDateTimeField8;
    TFIBBCDField *FIBBCDField15;
    TFIBDateTimeField *FIBDateTimeField9;
    TFIBDateTimeField *FIBDateTimeField10;
    TFIBBCDField *FIBBCDField16;
    TFIBBCDField *FIBBCDField17;
    TFIBBCDField *FIBBCDField18;
    TStringField *StringField5;
    TStringField *StringField6;
    TStringField *StringField7;
    TStringField *StringField8;
    TFIBStringField *FIBStringField4;
    TFIBMemoField *FIBMemoField2;
    TDataSource *DataSourceMedic;
    TpFIBDataSet *ds_head_mechanic;
    TFIBBCDField *FIBBCDField19;
    TFIBBCDField *FIBBCDField20;
    TFIBDateField *FIBDateField3;
    TFIBStringField *FIBStringField5;
    TFIBDateTimeField *FIBDateTimeField11;
    TFIBBCDField *FIBBCDField21;
    TFIBBCDField *FIBBCDField22;
    TFIBBCDField *FIBBCDField23;
    TFIBDateTimeField *FIBDateTimeField12;
    TFIBDateTimeField *FIBDateTimeField13;
    TFIBBCDField *FIBBCDField24;
    TFIBDateTimeField *FIBDateTimeField14;
    TFIBDateTimeField *FIBDateTimeField15;
    TFIBBCDField *FIBBCDField25;
    TFIBBCDField *FIBBCDField26;
    TFIBBCDField *FIBBCDField27;
    TStringField *StringField9;
    TStringField *StringField10;
    TStringField *StringField11;
    TStringField *StringField12;
    TFIBStringField *FIBStringField6;
    TFIBMemoField *FIBMemoField3;
    TDataSource *DataSourceMechanic;
    TDateTimePicker *var_date_mechanic;
    TLabel *Label12;
    TDateTimePicker *var_time_mechanic;
    TLabel *Label13;
    TDateTimePicker *var_date_on_route;
    TDateTimePicker *var_time_on_route;
    TpFIBDataSet *ds_head_on_route;
    TFIBBCDField *FIBBCDField28;
    TFIBBCDField *FIBBCDField29;
    TFIBDateField *FIBDateField4;
    TFIBStringField *FIBStringField7;
    TFIBDateTimeField *FIBDateTimeField16;
    TFIBBCDField *FIBBCDField30;
    TFIBBCDField *FIBBCDField31;
    TFIBBCDField *FIBBCDField32;
    TFIBDateTimeField *FIBDateTimeField17;
    TFIBDateTimeField *FIBDateTimeField18;
    TFIBBCDField *FIBBCDField33;
    TFIBDateTimeField *FIBDateTimeField19;
    TFIBDateTimeField *FIBDateTimeField20;
    TFIBBCDField *FIBBCDField34;
    TFIBBCDField *FIBBCDField35;
    TFIBBCDField *FIBBCDField36;
    TStringField *StringField13;
    TStringField *StringField14;
    TStringField *StringField15;
    TStringField *StringField16;
    TFIBStringField *FIBStringField8;
    TFIBMemoField *FIBMemoField4;
    TDataSource *DataSourceOnRoute;
    TButton *ButtonListOn;
    TButton *ButtonListOff;
    TButton *ButtonMedicOn;
    TButton *ButtonMedicOff;
    TButton *ButtonMechanicOn;
    TButton *ButtonMechanicOff;
    TButton *ButtonOnRouteOn;
    TButton *ButtonOnRouteOff;
    TpFIBQuery *query_run;
        TFIBBCDField *ds_head_listID_PERSONAL;
        void __fastcall FormShow(TObject *Sender);
        void __fastcall ButtonSaveClick(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall FormHide(TObject *Sender);
        void __fastcall ds_headCalcFields(TDataSet *DataSet);

        void __fastcall DBLookupComboBox3Exit(TObject *Sender);
    void __fastcall var_date_start_listChange(TObject *Sender);
    void __fastcall var_time_start_listChange(TObject *Sender);
    void __fastcall var_date_medicChange(TObject *Sender);
    void __fastcall var_time_medicChange(TObject *Sender);
    void __fastcall var_date_mechanicChange(TObject *Sender);
    void __fastcall var_time_mechanicChange(TObject *Sender);
    void __fastcall var_date_on_routeChange(TObject *Sender);
    void __fastcall var_time_on_routeChange(TObject *Sender);
    void __fastcall ButtonListOnClick(TObject *Sender);
    void __fastcall ButtonListOffClick(TObject *Sender);
    void __fastcall ButtonMedicOffClick(TObject *Sender);
    void __fastcall ButtonMechanicOffClick(TObject *Sender);
    void __fastcall ButtonOnRouteOffClick(TObject *Sender);
    void __fastcall ButtonMedicOnClick(TObject *Sender);
    void __fastcall ButtonMechanicOnClick(TObject *Sender);
    void __fastcall ButtonOnRouteOnClick(TObject *Sender);
private:	// User declarations
public:		// User declarations
        unsigned int id_state_doc;
        void __fastcall DelDoc(AnsiString id_head);
        void __fastcall SaveDocParent(TpFIBDataSet *ds_save,unsigned int id_state);
        __fastcall TFormOnRoute(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormOnRoute *FormOnRoute;
//---------------------------------------------------------------------------
#endif
